package com.zenithmind.library.pojo.domain;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zenithmind.common.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;

/**
 * 出版社实体
 * 
 * @author ZenithMind
 * @since 2024-06-14
 */
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Schema(name = "出版社实体", description = "出版社信息")
@TableName("lib_publisher")
public class Publisher extends BaseEntity {

    @NotBlank(message = "出版社名称不能为空")
    @Size(max = 200, message = "出版社名称长度不能超过200个字符")
    @Schema(description = "出版社名称")
    private String name;

    @Size(max = 200, message = "出版社英文名长度不能超过200个字符")
    @Schema(description = "出版社英文名")
    private String nameEn;

    @Size(max = 50, message = "出版社编码长度不能超过50个字符")
    @Schema(description = "出版社编码")
    private String code;

    @Schema(description = "成立日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate foundedDate;

    @Size(max = 100, message = "所在国家长度不能超过100个字符")
    @Schema(description = "所在国家")
    private String country;

    @Size(max = 100, message = "所在城市长度不能超过100个字符")
    @Schema(description = "所在城市")
    private String city;

    @Schema(description = "详细地址")
    @Size(max = 500, message = "详细地址长度不能超过500个字符")
    private String address;

    @Schema(description = "联系电话")
    @Size(max = 50, message = "联系电话长度不能超过50个字符")
    private String phone;

    @Email(message = "邮箱格式不正确")
    @Size(max = 100, message = "邮箱长度不能超过100个字符")
    @Schema(description = "联系邮箱")
    private String email;

    @Schema(description = "官方网站")
    private String website;

    @Schema(description = "出版社简介")
    @Size(max = 2000, message = "出版社简介长度不能超过2000个字符")
    private String description;

    @Schema(description = "出版社Logo")
    private String logo;

    @Schema(description = "状态 (0-禁用, 1-启用)")
    private Integer status;

    @Schema(description = "出版图书数量")
    private Integer bookCount;
}
